/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.entidade.registroimovel;

import br.com.deployment.entidade.acesso.Usuario;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author roniere
 */
@Entity
public class Registro implements Serializable  {
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @SequenceGenerator(name = "seq_registro", sequenceName = "seq_registro")
    @GeneratedValue(generator = "seq_registro", strategy = GenerationType.SEQUENCE)
    private Long id;
    
    @Column
    private int numero;
    
    @Column(length=25000)
    private String descricao;
    
    @Temporal(TemporalType.DATE)
    private Date dataRegistro;

    @OneToOne
    private Usuario usuario;

    public Date getDataRegistro() {
        return dataRegistro;
    }

    public void setDataRegistro(Date dataRegistro) {
        this.dataRegistro = dataRegistro;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Registro other = (Registro) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.numero != other.numero) {
            return false;
        }
        if ((this.descricao == null) ? (other.descricao != null) : !this.descricao.equals(other.descricao)) {
            return false;
        }
        if (this.dataRegistro != other.dataRegistro && (this.dataRegistro == null || !this.dataRegistro.equals(other.dataRegistro))) {
            return false;
        }
        if (this.usuario != other.usuario && (this.usuario == null || !this.usuario.equals(other.usuario))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 11 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 11 * hash + this.numero;
        hash = 11 * hash + (this.descricao != null ? this.descricao.hashCode() : 0);
        hash = 11 * hash + (this.dataRegistro != null ? this.dataRegistro.hashCode() : 0);
        hash = 11 * hash + (this.usuario != null ? this.usuario.hashCode() : 0);
        return hash;
    }
    
    
    
}
